export default {
    routerTo(obj) {
        let path = obj.path;
        let query = obj.query || '';
        let type = obj.type || 'NT';
        let str = '';
        if (!path) {
            console.log('路由错误')
            return
        }
        if (query) {
            str = '?'
            for (let i in query) {
                str += `${i}=${query[i]}&`
            }
        }
        console.log(path, query, type,str)
        if (type == 'NT') {
            uni.navigateTo({
                url: `${path}${str}`
            });
            return
        }
        
        if (type == 'RT') {
            uni.redirectTo({
                url: `${path}${str}`
            });
            return
        }
        if (type == 'RL') {
            uni.reLaunch({
                url: `${path}${str}`
            });
            return
        }
        if (type == 'ST') {
            uni.switchTab({
                url: `${path}${str}`
            });
            return
        }
        if (type == 'NB') {
            uni.navigateBack({
                delta: 1
            });
            return
        }
    }
}
